<?php

/**
 * item_objectif_vente filter form base class.
 *
 * @package    e-DSL
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class Baseitem_objectif_venteFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'owner_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('owner'), 'add_empty' => true)),
      'commercial_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('commercial'), 'add_empty' => true)),
      'fournisseur_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fournisseur'), 'add_empty' => true)),
      'produit_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('produit'), 'add_empty' => true)),
      'montant'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'owner_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('owner'), 'column' => 'id')),
      'commercial_id'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('commercial'), 'column' => 'id')),
      'fournisseur_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('fournisseur'), 'column' => 'id')),
      'produit_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('produit'), 'column' => 'id')),
      'montant'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('item_objectif_vente_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'item_objectif_vente';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'owner_id'       => 'ForeignKey',
      'commercial_id'  => 'ForeignKey',
      'fournisseur_id' => 'ForeignKey',
      'produit_id'     => 'ForeignKey',
      'montant'        => 'Number',
    );
  }
}
